Phase 12 - Refactoring: App promotion to Actor#188
Open
lorenzoberts wants to merge 6 commits into
Open
Conversation
This commit introduces the application actor protocol without changing runtime behavior. AppMessage defines the control and query messages for the upcoming AppActor, AppTransition models frame-cycle outcomes, and AppError gains variants for UI, input, and dependency failures at the actor boundary. This commit is part of the architecture's refactoring phase 12. Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit wraps the existing event loop in an AppActor and AppHandle without changing application behavior. main now spawns the actor and awaits run_until_done, establishing the actor lifecycle entry point while run logic still flows through the transitional handler path. This commit is part of the architecture's refactoring phase 12. Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit relocates screen-handling and loading logic under the app boundary and inlines the former run_app loop inside AppActor. The handler module is removed so application orchestration lives entirely within the app crate, with per-screen flows dispatched from the actor's input path. This commit is part of the architecture's refactoring phase 12. Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds the mpsc control path between AppHandle and AppActor. The handle exposes shutdown, get_view_model, and get_input_context over the message protocol while input events continue through the existing subscriber channel, separating control queries from the hot input loop. This commit is part of the architecture's refactoring phase 12. Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit makes startup validation an AppActor concern. External dependency checks run at the beginning of the actor loop and surface failures as AppError through run_until_done, removing the ad hoc validation path from main. AppHandle::initialize remains available over the message protocol for explicit queries. This commit is part of the architecture's refactoring phase 12. Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This commit adds structured tracing across AppActor lifecycle, message handling, and I/O-heavy flow branches without changing behavior. Actor start, stop, initialization failures, and per-screen dispatch are observable through the tracing subscriber. This commit completes the architecture's refactoring phase 12. Signed-off-by: lorenzoberts <lorenzobs@usp.br>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
With all other actors in place, formally convert App into the central orchestration actor. Application logic should live behind a typed message protocol instead of a free-standing handler loop in main.
What this PR does
Introduces AppMessage, AppTransition, AppError, AppHandle, and AppActor. The former run_app loop in handler/mod.rs moves into AppActor; per-screen flows relocate to app/flows/ and the handler module is deleted. AppHandle exposes shutdown, get_view_model, and get_input_context over an mpsc control channel, separate from the hot input subscriber path.
main.rs spawns AppActor and awaits run_until_done instead of calling run_app directly. Startup dependency checks move into the actor loop and surface as AppError. Structured tracing is added across actor lifecycle, message handling, and per-screen dispatch. Runtime behavior is unchanged.